@file:JvmMultifileClass
@file:JvmName("CloseUtils")

package hos.kotlin

import java.io.Closeable
import java.io.Flushable

/**
 * <p>Title: IOExt </p>
 * <p>Description:  </p>
 * <p>Company: www.mapuni.com </p>
 *
 * @author : 蔡俊峰
 * @date : 2024-07-30 13:32
 * @version : 1.0
 */
fun Closeable?.closeQuietly() {
    if (this == null) return
    try {
        this.close()
    } catch (_: Exception) {
    }
}

fun Flushable?.flushQuietly() {
    if (this == null) return
    try {
        this.flush()
    } catch (_: Exception) {
    }
}